/*
 * @Description: 高级搜索- 操作组件
 * @Author: Rfan
 * @Date: 2022-04-06 16:26:36
 * @LastEditTime: 2022-05-24 19:34:20
 */

import { Button, Col, Row, Space } from 'antd';
import { useExpGeneratorDialogContext } from '../contexts/ExpGeneratorDialogContext';

const OperateWrap = () => {
  const { deleteLastConditionItem, clearConditionList } = useExpGeneratorDialogContext();

  /**
   * 删除条件列表最后一项
   */
  const deleteLast: () => void = () => {
    console.log('del');
    deleteLastConditionItem();
  };

  /**
   * 清空条件列表
   */
  const clearConditionListFn = () => {
    clearConditionList();
  };

  return (
    <div className="operate-wrap">
      <Row gutter={20}>
        <Col>
          <Space>
            <Button onClick={() => clearConditionListFn()}>清空条件</Button>
            <Button type="primary" onClick={() => deleteLast()}>
              删除末项
            </Button>
          </Space>
        </Col>
      </Row>
    </div>
  );
};

export default OperateWrap;
